<%@ tag language="java" pageEncoding="UTF-8"%>

<%@ attribute name="id"%>
<%@ attribute name="title"%>
<%@ attribute name="onclick"%>
<%@ attribute name="name" rtexprvalue="true" required="true"%>
<%@ attribute name="list" rtexprvalue="true" required="true"%>
<%@ attribute name="maxlength" rtexprvalue="true"%>
<%@ attribute name="value" rtexprvalue="true"%>
<%@ attribute name="label" rtexprvalue="true"%>
<%@ attribute name="required" rtexprvalue="true"%>
<%@ attribute name="single" rtexprvalue="true"%>
<%@ attribute name="help" rtexprvalue="true"%>
<%@ attribute name="onchange" rtexprvalue="true"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="base" uri="/WEB-INF/mytags.tld"%>

<c:if test="${required==null}">
	<c:set var="required" value="false" />
</c:if>

<base:map var="items" value="${list}" />

<c:choose>
	<c:when test="${single==null}">
		<c:set var="single" value="1" />
	</c:when>
	<c:when test="${single==1}">
		<c:set var="single" value="3" />
	</c:when>
	<c:otherwise>
		<c:set var="single" value="1" />
	</c:otherwise>
</c:choose>

<th><c:if test="${required}">
	<label class="requireField">*</label>
</c:if> <label>${label}:</label></th>

<td colspan="${single}"><c:forEach var="item" items="${items}" varStatus="status">
	<input type="radio" name="${name}"
		<c:if test="${id!=null}"> id="${id}"</c:if>
		<c:if test="${title!=null}"> title="${title}"</c:if>
		<c:if test="${size!=null}"> size="${size}"</c:if>
		<c:if test="${onclick!=null}"> onclick="${onclick}"</c:if>
		<c:if test="${value==item.key}"> checked="checked"</c:if>
		<c:if test="${value==null&&status.index==0}"> checked="checked"</c:if>
		value="${item.key}" />
			${item.value}
</c:forEach>${help}</td>